<?php

namespace app\api\controller\event;

use app\api\model\Yunlue;
use app\api\service\event\EventService;
use think\facade\Request;

class Event
{
    protected $Service;
    public function __construct()
    {
        $this->Service = EventService::getInstance();
    }


    /**
     * 任务分发
     * @return \think\response\Json
     */
    public function distribute(){
        $params = Request::get();
        $result = $this->Service->distribute($params);

        return writeJson(200,$result,'数据列表！');
    }


    /**
     * 发布完成
     * @return \think\response\Json
     */
    public function write(){
        $params = Request::post();
        $this->Service->write($params);
        return writeJson(200,'','发布完成！');
    }

    /**
     * 获取云略账号
     * @return \think\response\Json
     */
    public function getyunlue(){
        $account = Yunlue::find();
        return writeJson(200,$account,'云略账号');
    }


    /**
     * 数据采集
     * @return \think\response\Json
     */
    public function store(){
        $params = Request::post();
        $result = $this->Service->store($params['data']);
        return writeJson(200,$result,'更新完成！');
    }

    public function addStudyImg(){
        $params = Request::post();
        $result = $this->Service->addStudyImg($params);
        return writeJson(200,$result,'保存成功！');
    }


}
